import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/view/layout/Layout';

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/login',
    name: 'Login',
    hidden: true,
    component: () => import('@/view/login/index')
  },
  {
    path: '/',
    name: '首页',
    hidden: false,
    icon: 'el-icon-s-home',
    component: Layout,
    redirect: "/dashboard",  //重定向
    children: [{
      name: '首页概况',
      path: 'dashboard',
      hidden: false,
      component: () => import('@/view/home/index'),
      meta: {
        icon: 'el-icon-s-home'
      }
    }]
  },
  {
    path: '/',
    name: '项目管理',
    hidden: false,
    icon: 'el-icon-collection',
    component: Layout,
    children: [{
      name: '项目管理',
      path: 'project',
      hidden: false,
      component: () => import('@/view/interface/project/index'),
      meta: {
        icon: 'el-icon-collection'
      }
    }]
  },
  {
    path: '/interface',
    name: '接口管理',
    hidden: false,
    icon: 'el-icon-set-up',
    component: Layout,
    children: [{
      name: '接口列表',
      path: 'interfaceManager',
      hidden: false,
      component: () => import('@/view/interface/interface/interfaceManager'),
      meta: {
        icon: 'el-icon-place'
      }
    },
      {
        name: '接口配置',
        path: 'interfaceSetting',
        hidden: false,
        component: () => import('@/view/interface/interface/interfaceManager'),
        meta: {
          icon: 'el-icon-edit-outline'
        }
      }]
  },
  {
    path: '/interface/:interfaceId',
    component: Layout,
    redirect: '/interface/:interfaceId',
    name: '接口预览',
    hidden: true,
    children: [{
      path: '/interface/:interfaceId',
      component: () => import('@/view/interface/interface/interfaceDetail'),
      name: '接口预览', //路由名称
      hidden: true,
      meta: {
        title: '接口预览',
        icon: 'el-icon-s-management',
        affix: true,
      }
    }]
  },
]

export default new Router({
  mode: "history",
  routes: constantRouterMap
})


